package com.demo.study.algorithm.leetcode.array.easy;

/**
 * LT26
 * <a href="https://leetcode.cn/problems/remove-duplicates-from-sorted-array/description">删除有序数组中的重复项</a>
 *
 * @author Baymax
 * @since 2024-11-17
 */
public class LT26 {

    public int removeDuplicates(int[] nums) {
        int num = nums[0];
        int point = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] != num) {
                nums[point] = nums[i];
                point++;
                num = nums[i];
            }
        }
        return point;
    }

}
